package com.xt.purchasingsystem.utils;

import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * Object对象转换其他对象的工具类
 * @author: 老姚
 * Date:  2020/5/22 23:11
 */
public class ConvertUtil {
    public static <T> T convertValue(Object bean, Class<T> clazz) {
        try {
            ObjectMapper mapper = new ObjectMapper();
            return mapper.convertValue(bean, clazz);
        } catch (Exception e) {
            return null;
        }
    }
}
